pub fn convert_base(num_base_str: &str, to_base: u32) -> String {
    let mut result = String::new();
    if let Some(left_pos) = num_base_str.find('(') {
        if let Some(right_pos) = num_base_str.find(')') {
            let base = num_base_str[left_pos + 1..right_pos].parse().unwrap();
            let mut decimal = 0;
            for i in 0..left_pos {
                decimal += num_base_str.chars().nth(i).unwrap().to_digit(base).unwrap() * base.pow((left_pos - i - 1) as u32);
            }    
            while decimal > 0 {
                let remainder = decimal % to_base;
                let digit = if remainder < 10 {
                    std::char::from_digit(remainder, to_base).unwrap()
                } else {
                    (b'a' + (remainder - 10) as u8) as char
                };
                result.push(digit);
                decimal /= to_base;
            }
        }
    }
    
    result.chars().rev().collect()
}
